﻿<%@ Page Title="Contract Report" Language="C#" MasterPageFile="~/AuditBillingMaster.master" AutoEventWireup="true" CodeFile="ContractsReport.aspx.cs" Inherits="ContractsReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script src="../JS/Forms/jsContractsReport.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cntList" runat="Server">
    <asp:HiddenField runat="server" ID="hdnExportToExcelFilePath" ClientIDMode="Static" />
    <asp:HiddenField runat="server" ID="hdnUploadLink" ClientIDMode="Static" />
    <input type="hidden" id="hdnContractID" runat="server" value="0" clientidmode="Static" />
    <div class="pagecontent">
        <div class="headercontainer">
            <div class="headertextcontainer halfpanel">
                Contract Report
            </div>
            <div class="headerbuttoncontainer halfpanel">
                <a id="A1" href='javascript:void(0);' onclick="toggle_TopContainer();" tabindex="12" class="headersearchbutton" title="Toggle Search Panel" runat="server">Search</a>&nbsp;&nbsp;
                <a href="ContractsReport.aspx?Excel" class="headerexportbutton" tabindex="13">Export To Excel</a>
            </div>
        </div>
        <div id="divTopContainer" class="topcontainerwrapper">
            <div class="topcontainerSmall" onkeypress="javascript:return fireDefaultButton(event, 'btnSearch')">
                <div class="halfpanel">
                    <div class="row">
                        <asp:DropDownList ID="cboCompany" ClientIDMode="Static" runat="server" TabIndex="2" multiple="multiple" placeholder="All Companies"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboContract" ClientIDMode="Static" runat="server" TabIndex="4" multiple="multiple" placeholder="All Contracts"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>

                    <div class="clear"></div>
                    <div class="row">
                        <div class="labelPad4">
                            Contract Start Date
                        </div>
                        <div class="value">
                            <div class="input-append date">
                                <asp:TextBox ID="txtContractStartDate" runat="server" ClientIDMode="Static" MaxLength="50"
                                    onclick="show_DateCalender('txtContractStartDate');" TabIndex="6" CssClass="dateinput"
                                    ReadOnly="true" placeholder="dd/mm/yyyy" onkeydown="javascript:return clearDates(event);"></asp:TextBox>
                                <span class="add-on" id="Span8" onclick="show_DateCalender('txtContractStartDate');" style="float: right"><i
                                    class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="labelPad4">
                            Contract End Date
                        </div>
                        <div class="value">
                            <div class="input-append date">
                                <asp:TextBox ID="txtContractEndDate" runat="server" ClientIDMode="Static" MaxLength="50"
                                    onclick="show_DateCalender('txtContractEndDate');" TabIndex="7" CssClass="dateinput"
                                    ReadOnly="true" placeholder="dd/mm/yyyy" onkeydown="javascript:return clearDates(event);"></asp:TextBox>
                                <span class="add-on" id="Span5" onclick="show_DateCalender('txtContractEndDate');" style="float: right"><i
                                    class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="halfpanel">
                    <div class="row">
                        <asp:DropDownList ID="cboClient" ClientIDMode="Static" runat="server" TabIndex="3" multiple="multiple" placeholder="All Clients"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboPaymentMode" ClientIDMode="Static" runat="server" TabIndex="5" multiple="multiple" placeholder="All Payment Modes"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboStatus" ClientIDMode="Static" runat="server" TabIndex="8" placeholder="All Status"
                            CssClass="searchCntrl" Width="70%">
                            <asp:ListItem Value="2" Text="Both [Active / InActive]"></asp:ListItem>
                            <asp:ListItem Value="1" Text="Active"></asp:ListItem>
                            <asp:ListItem Value="0" Text="InActive"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboFinancialYear" ClientIDMode="Static" runat="server" TabIndex="8" placeholder="Current Financial Year" multiple="multiple"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>

                </div>
                <div class="fullpanel textalignright">
                    <a tabindex="9" class="btn-search-clear" onclick="clear_form_elements('divTopContainer');" onkeypress="clear_form_elements_ForTab(event,'divTopContainer');" href="javascript:void(0);">Clear</a>
                    <input type="button" id="btnSearch" tabindex="10" class="btn-search" onclick="javascript: return fn_GetSearchResult(0);"
                        value="Search" title="Search" />
                </div>
            </div>
            <a href='javascript:void(0);' class="closedivSmall" onclick="toggle_TopContainer();" title="Toggle Search Panel" tabindex="11"><i class="fa fa-chevron-up"></i></a>
        </div>
        <div class="maincontainer">
            <div class="listpagediv" id="divResult">
                <asp:GridView ID="grdResult" runat="server" ClientIDMode="Static" AutoGenerateColumns="false" Width="90%" CssClass="listdiv" DataKeyNames="TrnContractID" OnRowDataBound="grdResult_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="TrnContractID" HeaderText="Contract ID" />
                        <asp:BoundField HeaderText="Sr." ItemStyle-HorizontalAlign="Center" />
                        <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <a class="btn-edit" href="javascript:void(0);" onclick="return ShowEditDiv(this);" title="View Details"><i class="fa fa-eye" title="View Details"></i></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="ContractNo" HeaderText="Contract#" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Company" />
                        <asp:BoundField DataField="ClientName" HeaderText="Client" />
                        <asp:BoundField DataField="ContractName" HeaderText="Contract" />
                        <asp:BoundField DataField="PaymentModeName" HeaderText="Payment Mode" />
                        <asp:BoundField DataField="ContractStartDate" HeaderText="Contract Start Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
                        <asp:BoundField DataField="FinancialYearName" HeaderText="Financial Year" />
                        <asp:BoundField DataField="ContractAmount" HeaderText="Contract Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                        <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%#(Convert.ToBoolean(Eval("IsActive")) == true ? "Active" : "InActive") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Document" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%#(Convert.ToString(Eval("ContractFilePath")) == "" ?"":
                                string.Format("<a href=\"{0}\" class=\"btn-edit\" target=\"_blank\" href=\"javascript:void(0);\"title=\"Download Document\"><i class=\"fa fa-download\" title=\"Download Document\"></i></a>",Eval("ContractFilePath").ToString())) 
                                %>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>

        </div>
    </div>
    <div class="modalopenConfirmDel modalopenInvoice" style="display: none;">
    </div>

    <div id="divShowDetails" class="modalinvoice" onkeypress="javascript:return fireDefaultButton(event, 'btnSave')">
        <div class="form">
            <div class="innercontent">
                <div class="halfpanel">
                    <div class="row">
                        <div class="midium-label">
                            Company
                        </div>
                        <div class="midium-value">
                            <div>
                                <asp:Label ID="lblCompanyName" ClientIDMode="Static" runat="server"></asp:Label>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Client
                        </div>
                        <div class="midium-value">
                            <div>
                                <asp:Label ID="lblClientName" ClientIDMode="Static" runat="server"></asp:Label>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Contract
                        </div>
                        <div class="midium-value">
                            <div>
                                <asp:Label ID="lblContractName" ClientIDMode="Static" runat="server"></asp:Label>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>

                </div>
                <div class="halfpanel">
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
                <br />
                <div class="maincontainer">
                    <div class="listpagediv" id="divInvoiceDetails" runat="server" clientidmode="Static">
                        <asp:GridView ID="grdInvoiceDetails" runat="server" ClientIDMode="Static" AutoGenerateColumns="false" Width="95%" CssClass="listdiv" OnRowDataBound="grdInvoiceDetails_RowDataBound"
                            EmptyDataText="There is no any Invoice Generated." EmptyDataRowStyle-HorizontalAlign="Center">
                            <Columns>
                                <asp:BoundField HeaderText="Sr." ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="InvoiceNo" HeaderText="Invoice #" />
                                <asp:BoundField DataField="PaymentModeName" HeaderText="Payment Mode" />
                                <asp:BoundField DataField="InvoiceDate" HeaderText="Invoice Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="PaymentLevelPer" HeaderText="Contract %" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />

                                <asp:BoundField DataField="GrossInvoiceAmount" HeaderText="Gross Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                                <asp:BoundField DataField="ServiceTaxPer" HeaderText="Service Tax %" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0.00}" />
                                <asp:BoundField DataField="ServiceTaxAmount" HeaderText="Service Tax Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                                <asp:BoundField DataField="FinalInvoiceAmount" HeaderText="Final Invoice Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                            </Columns>
                        </asp:GridView>
                    </div>
                </div>
                <br />
                <br />
                <div class="clear"></div>
                <div class="maincontainer">
                    <div class="listpagediv" id="divCollectionDetails" runat="server" clientidmode="Static">
                        <asp:GridView ID="grdCollectionDetails" runat="server" ClientIDMode="Static" AutoGenerateColumns="false" Width="95%" CssClass="listdiv" OnRowDataBound="grdCollectionDetails_RowDataBound"
                            EmptyDataText="There is no any collection added." EmptyDataRowStyle-HorizontalAlign="Center">
                            <Columns>
                                <asp:BoundField HeaderText="Sr." ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="InvoiceNo" HeaderText="Invoice #" />
                                <asp:BoundField DataField="CollectionNo" HeaderText="Collection #" />
                                <asp:BoundField DataField="CollectionDate" HeaderText="Collection Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="CollectionType" HeaderText="Collection Type" />
                                <asp:BoundField DataField="DrawnOnBank" HeaderText="Drawn Bank" />
                                <asp:BoundField DataField="CollectionRefNo" HeaderText="Ref. No." />
                                <asp:BoundField DataField="Amount" HeaderText="Amount" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0}" />
                                <asp:TemplateField HeaderText="TDS Amount" ItemStyle-HorizontalAlign="Right">
                                    <ItemTemplate>
                                        <%#TrynParse.parseDecimal(Eval("TDSAmount")) == 0 ? "-" : TrynParse.parseDecimal(Eval("TDSAmount")).ToString("#,##0") %>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:BoundField DataField="GrossAmount" HeaderText="Gross Amount" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#,##0}" />
                            </Columns>
                        </asp:GridView>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cntMain" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FootContent" runat="Server">
</asp:Content>

